<?php
/**
 * Created by PhpStorm.
 * User: dapeng
 * Date: 2019-12-12
 * Time: 11:10
 */

class Person
{
    public $name;
    public $age;
    public $study;
    public $other;
    //构造方法（创建）
    public function __construct($name,$age)
    {
        $this->age = $age;
        $this->name = $name;
//        $this->study = $study;
        //连接数据库
        //打开文件fopen

//        echo "对象实例化了";

    }
    function chifan(){
        echo $this->name."在吃饭";
    }
    function gouwu(){
        echo $this->name."在购物";
    }
    //析构方法（销毁）
    public function __destruct()
    {
        //释放人的一些权力
        //释放内存
        //关闭数据库
        //fclose
        echo $this->name."被销毁了";
    }
    function info(){
        echo "我叫".$this->name."，年龄".$this->age."，".$this->study."，我会".$this->other;
    }

}